package top.laoshuzi.scad.mosinnagant.config

import eu.printingin3d.javascad.models.IModel
import eu.printingin3d.javascad.openscad.Consts
import eu.printingin3d.javascad.utils.SaveScadFiles
import top.laoshuzi.scad.mosinnagant.utils.ScadConstants.scadName
import java.io.File

/**
 * Created by mouse on 2019/7/19.
 */
class Scad(private val config: ScadConfig) {

    fun generate(vararg models: IModel) {
        SaveScadFiles(File(config.outDir))
            .apply {
                ArrayList<IModel>().apply {
                    add(Consts())
                    addAll(models)
                }.run {
                    addModels(scadName, this)
                }
                saveScadFiles()
            }
    }

}

data class ScadConfig(
    var outDir: String = "",
    var scadName: String = ""
)